// /**
// //  * Magento
//  *
//  * NOTICE OF LICENSE
//  *
//  * This source file is subject to the Academic Free License (AFL 3.0)
//  * that is bundled with this package in the file LICENSE_AFL.txt.
//  * It is also available through the world-wide-web at this URL:
//  * http://opensource.org/licenses/afl-3.0.php
//  * If you did not receive a copy of the license and are unable to
//  * obtain it through the world-wide-web, please send an email
//  * to license@magentocommerce.com so we can send you a copy immediately.
//  *
//  * DISCLAIMER
//  *
//  * Do not edit or add to this file if you wish to upgrade Magento to newer
//  * versions in the future. If you wish to customize Magento for your
//  * needs please refer to http://www.magentocommerce.com for more information.
//  *
//  * @category    design
//  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
//  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
//  */

// Simple dropdown
.dropdown(
    @_toggle-selector : ~".action.toggle",
    @_options-selector : ~"ul.dropdown",

    @_dropdown-actions-padding: @dropdown-actions-padding,
    @_dropdown-list-min-width: @dropdown-list-min-width,
    @_dropdown-list-width: @dropdown-list-width,
    @_dropdown-list-height: @dropdown-list-height,
    @_dropdown-list-position-top: @dropdown-list-position-top,
    @_dropdown-list-position-bottom: @dropdown-list-position-bottom,
    @_dropdown-list-position-left: @dropdown-list-position-left,
    @_dropdown-list-position-right: @dropdown-list-position-right,
    @_dropdown-list-background: @dropdown-list-background,
    @_dropdown-list-border: @dropdown-list-border,
    @_dropdown-list-pointer: @dropdown-list-pointer,
    @_dropdown-list-pointer-border: @dropdown-list-pointer-border,
    @_dropdown-list-pointer-position: @dropdown-list-pointer-position,
    @_dropdown-list-pointer-position-top: @dropdown-list-pointer-position-top,
    @_dropdown-list-pointer-position-left-right: @dropdown-list-pointer-position-left-right,
    @_dropdown-list-item-border: @dropdown-list-item-border,
    @_dropdown-list-item-padding: @dropdown-list-item-padding,
    @_dropdown-list-item-margin: @dropdown-list-item-margin,
    @_dropdown-list-item-hover: @dropdown-list-item-hover,
    @_dropdown-list-shadow: @dropdown-list-shadow,
    @_dropdown-list-z-index: @dropdown-list-z-index,

    @_dropdown-toggle-icon-content: @dropdown-toggle-icon-content,
    @_dropdown-toggle-active-icon-content: @dropdown-toggle-active-icon-content,

    @_icon-font: @dropdown-toggle-icon-font,
    @_icon-font-size: @dropdown-toggle-icon-font-size,
    @_icon-font-line-height: @dropdown-toggle-icon-font-line-height,
    @_icon-font-color: @dropdown-toggle-icon-font-color,
    @_icon-font-color-hover: @dropdown-toggle-icon-font-color-hover,
    @_icon-font-color-active: @dropdown-toggle-icon-font-color-active,
    @_icon-font-margin: @dropdown-toggle-icon-font-margin,
    @_icon-font-position: @dropdown-toggle-icon-position,
    @_icon-font-vertical-align: @dropdown-toggle-icon-font-vertical-align,
    @_icon-font-text-hide: @dropdown-toggle-icon-text-hide
) {
    .clearfix();
    display: inline-block;
    position: relative;
    //overflow: hidden;
    @{_toggle-selector} {
        .css(padding, @_dropdown-actions-padding);
        cursor: pointer;
        ._dropdown-icon(
            @_dropdown-toggle-icon-content,
            @_dropdown-toggle-active-icon-content,
            @_icon-font,
            @_icon-font-size,
            @_icon-font-line-height,
            @_icon-font-color,
            @_icon-font-color-hover,
            @_icon-font-color-active,
            @_icon-font-margin,
            @_icon-font-vertical-align,
            @_icon-font-position,
            @_icon-font-text-hide
        );
    }
    ._dropdown-styles(
        @_options-selector: @_options-selector,
        @_dropdown-list-min-width,
        @_dropdown-list-width,
        @_dropdown-list-height,
        @_dropdown-list-background,
        @_dropdown-list-border,
        @_dropdown-list-z-index,
        @_dropdown-list-shadow,
        @_dropdown-list-background,
        @_dropdown-list-item-padding,
        @_dropdown-list-item-margin,
        @_dropdown-list-item-border,
        @_dropdown-list-item-hover,
        @_dropdown-list-position-top,
        @_dropdown-list-position-bottom,
        @_dropdown-list-position-left,
        @_dropdown-list-position-right,
        @_dropdown-list-pointer,
        @_dropdown-list-pointer-border,
        @_dropdown-list-pointer-position,
        @_dropdown-list-pointer-position-top,
        @_dropdown-list-pointer-position-left-right
    );
}

// Split dropdown
.dropdown-split(
    @_toggle-selector : ~".action.toggle",
    @_options-selector : ~"ul.dropdown",
    @_button-selector : ~".action.split",

    @_dropdown-split-actions-padding: @dropdown-split-actions-padding,
    @_dropdown-split-button-actions-padding: @dropdown-split-button-actions-padding,
    @_dropdown-split-toggle-actions-padding: @dropdown-split-toggle-actions-padding,
    @_dropdown-split-toggle-position: @dropdown-split-toggle-position,
    @_dropdown-split-list-min-width: @dropdown-split-list-min-width,
    @_dropdown-split-list-width: @dropdown-split-list-width,
    @_dropdown-split-list-height: @dropdown-split-list-height,
    @_dropdown-split-list-position-top: @dropdown-split-list-position-top,
    @_dropdown-split-list-position-bottom: @dropdown-split-list-position-bottom,
    @_dropdown-split-list-position-left: @dropdown-split-list-position-left,
    @_dropdown-split-list-position-right: @dropdown-split-list-position-right,
    @_dropdown-split-list-background: @dropdown-split-list-background,
    @_dropdown-split-list-border: @dropdown-split-list-border,
    @_dropdown-split-list-pointer: @dropdown-split-list-pointer,
    @_dropdown-split-list-pointer-border: @dropdown-split-list-pointer-border,
    @_dropdown-split-list-pointer-position: @dropdown-split-list-pointer-position,
    @_dropdown-split-list-pointer-position-top: @dropdown-split-list-pointer-position-top,
    @_dropdown-split-list-pointer-position-left-right: @dropdown-split-list-pointer-position-left-right,
    @_dropdown-split-list-item-border: @dropdown-split-list-item-border,
    @_dropdown-split-list-item-padding: @dropdown-split-list-item-padding,
    @_dropdown-split-list-item-margin: @dropdown-split-list-item-margin,
    @_dropdown-split-list-item-hover: @dropdown-split-list-item-hover,
    @_dropdown-split-button-border-radius-fix: @dropdown-split-button-border-radius-fix,
    @_dropdown-split-list-shadow: @dropdown-split-list-shadow,
    @_dropdown-split-list-z-index: @dropdown-split-list-z-index,

    @_dropdown-split-toggle-icon-content: @dropdown-split-toggle-icon-content,
    @_dropdown-split-toggle-active-icon-content: @dropdown-split-toggle-active-icon-content,

    @_icon-font: @dropdown-split-toggle-icon-font,
    @_icon-font-size: @dropdown-split-toggle-icon-font-size,
    @_icon-font-line-height: @dropdown-split-toggle-icon-font-line-height,
    @_icon-font-color: @dropdown-split-toggle-icon-font-color,
    @_icon-font-color-hover: @dropdown-split-toggle-icon-font-color-hover,
    @_icon-font-color-active: @dropdown-split-toggle-icon-font-color-active,
    @_icon-font-margin: @dropdown-split-toggle-icon-font-margin,
    @_icon-font-vertical-align: @dropdown-split-toggle-icon-font-vertical-align,
    @_icon-font-position: @dropdown-split-toggle-icon-position,
    @_icon-font-text-hide: @dropdown-split-toggle-icon-text-hide
) {
    .clearfix();
    display: inline-block;
    position: relative;
    //overflow: hidden;
    ._dropdown-split-toggle-position(
        @_button-selector,
        @_toggle-selector,
        @_dropdown-split-toggle-position,
        @_dropdown-split-button-border-radius-fix
    );
    @{_button-selector} {
        .css(padding, @_dropdown-split-button-actions-padding);
    }
    @{_toggle-selector} {
        .css(padding, @_dropdown-split-toggle-actions-padding);
        ._dropdown-split-icon(
            @_dropdown-split-toggle-icon-content,
            @_dropdown-split-toggle-active-icon-content,
            @_icon-font,
            @_icon-font-size,
            @_icon-font-line-height,
            @_icon-font-color,
            @_icon-font-color-hover,
            @_icon-font-color-active,
            @_icon-font-margin,
            @_icon-font-vertical-align,
            @_icon-font-position,
            @_icon-font-text-hide
        );
    }
    ._dropdown-styles(
        @_options-selector: @_options-selector,
        @_dropdown-split-list-min-width,
        @_dropdown-split-list-width,
        @_dropdown-split-list-height,
        @_dropdown-split-list-background,
        @_dropdown-split-list-border,
        @_dropdown-split-list-z-index,
        @_dropdown-split-list-shadow,
        @_dropdown-split-list-background,
        @_dropdown-split-list-item-padding,
        @_dropdown-split-list-item-margin,
        @_dropdown-split-list-item-border,
        @_dropdown-split-list-item-hover,
        @_dropdown-split-list-position-top,
        @_dropdown-split-list-position-bottom,
        @_dropdown-split-list-position-left,
        @_dropdown-split-list-position-right,
        @_dropdown-split-list-pointer,
        @_dropdown-split-list-pointer-border,
        @_dropdown-split-list-pointer-position,
        @_dropdown-split-list-pointer-position-top,
        @_dropdown-split-list-pointer-position-left-right
    );
}

// Internal use mixins
._dropdown-styles(
    @_options-selector,
    @_dropdown-list-min-width,
    @_dropdown-list-width,
    @_dropdown-list-height,
    @_dropdown-list-background,
    @_dropdown-list-border,
    @_dropdown-list-z-index,
    @_dropdown-list-shadow,
    @_dropdown-list-background,
    @_dropdown-list-item-padding,
    @_dropdown-list-item-margin,
    @_dropdown-list-item-border,
    @_dropdown-list-item-hover,
    @_dropdown-list-position-top,
    @_dropdown-list-position-bottom,
    @_dropdown-list-position-left,
    @_dropdown-list-position-right,
    @_dropdown-list-pointer,
    @_dropdown-list-pointer-border,
    @_dropdown-list-pointer-position,
    @_dropdown-list-pointer-position-top,
    @_dropdown-list-pointer-position-left-right,
) {
    @{_options-selector} {
        .list-reset-styles();
        .box-sizing();
        .css(background, @_dropdown-list-background);
        .css(border, @_dropdown-list-border);
        position: absolute;
        .css(z-index, @_dropdown-list-z-index);
        ._dropdown-list-position(
            @_dropdown-list-position-top,
            @_dropdown-list-position-bottom,
            @_dropdown-list-position-left,
            @_dropdown-list-position-right
        );
        .css(min-width, @_dropdown-list-min-width);
        .css(width, @_dropdown-list-width);
        .css(height, @_dropdown-list-height);
        display: none;
        ._dropdown-list-shadow(@_dropdown-list-shadow);
        li {
            .css(margin, @_dropdown-list-item-margin);
            .css(padding, @_dropdown-list-item-padding);
            ._dropdown-list-item-border(
                @_dropdown-list-item-border
            );
            &:hover {
                .css(background, @_dropdown-list-item-hover);
                cursor: pointer;
            }
        }
        ._dropdown-list-pointer(
            @_dropdown-list-background,
            @_dropdown-list-pointer-border,
            @_dropdown-list-pointer-position,
            @_dropdown-list-pointer-position-top,
            @_dropdown-list-pointer-position-left-right,
        );
    }
    &.active {
        overflow: visible;
        @{_options-selector} {
            display: block;
        }
    }
}

// Dropdown list position
._dropdown-list-position(
    @_dropdown-list-position-top,
    @_dropdown-list-position-bottom,
    @_dropdown-list-position-left,
    @_dropdown-list-position-right,
) when not (@_dropdown-list-position-top = false) and not (@_dropdown-list-position-top = auto) {
    .css(top, @_dropdown-list-position-top);
}

._dropdown-list-position(
    @_dropdown-list-position-top,
    @_dropdown-list-position-bottom,
    @_dropdown-list-position-left,
    @_dropdown-list-position-right
) when not (@_dropdown-list-position-bottom = false) and not (@_dropdown-list-position-bottom = auto) {
    .css(bottom, @_dropdown-list-position-bottom);
}

._dropdown-list-position(
    @_dropdown-list-position-top,
    @_dropdown-list-position-bottom,
    @_dropdown-list-position-left,
    @_dropdown-list-position-right
) when not (@_dropdown-list-position-left = false) and not (@_dropdown-list-position-left = auto) {
    .css(left, @_dropdown-list-position-left);
}

._dropdown-list-position(
    @_dropdown-list-position-top,
    @_dropdown-list-position-bottom,
    @_dropdown-list-position-left,
    @_dropdown-list-position-right
) when not (@_dropdown-list-position-right = false) and not (@_dropdown-list-position-right = auto) {
    .css(right, @_dropdown-list-position-right);
}

// Simple dropdown icon
._dropdown-icon(
    @_dropdown-toggle-icon-content,
    @_dropdown-toggle-active-icon-content,
    @_icon-font,
    @_icon-font-size,
    @_icon-font-line-height,
    @_icon-font-color,
    @_icon-font-color-hover,
    @_icon-font-color-active,
    @_icon-font-margin,
    @_icon-font-vertical-align,
    @_icon-font-position,
    @_icon-font-text-hide
) {
    .icon-font(
        @_icon-font-content: @_dropdown-toggle-icon-content,
        @_icon-font: @_icon-font,
        @_icon-font-size: @_icon-font-size,
        @_icon-font-line-height: @_icon-font-line-height,
        @_icon-font-color: @_icon-font-color,
        @_icon-font-color-hover: @_icon-font-color-hover,
        @_icon-font-color-active: @_icon-font-color-active,
        @_icon-font-margin: @_icon-font-margin,
        @_icon-font-vertical-align: @_icon-font-vertical-align,
        @_icon-font-position: @_icon-font-position,
        @_icon-font-text-hide: @_icon-font-text-hide
    );
    &.active {
        .icon-font(
            @_icon-font-content: @_dropdown-toggle-active-icon-content,
            @_icon-font: @_icon-font,
            @_icon-font-size: @_icon-font-size,
            @_icon-font-line-height: @_icon-font-line-height,
            @_icon-font-color: @_icon-font-color,
            @_icon-font-color-hover: @_icon-font-color-hover,
            @_icon-font-color-active: @_icon-font-color-active,
            @_icon-font-margin: @_icon-font-margin,
            @_icon-font-vertical-align: @_icon-font-vertical-align,
            @_icon-font-position: @_icon-font-position,
            @_icon-font-text-hide: @_icon-font-text-hide
        );
    }
}

//Split dropdown icon
._dropdown-split-icon(
    @_dropdown-toggle-icon-content,
    @_dropdown-toggle-active-icon-content,
    @_icon-font,
    @_icon-font-size,
    @_icon-font-line-height,
    @_icon-font-color,
    @_icon-font-color-hover,
    @_icon-font-color-active,
    @_icon-font-margin,
    @_icon-font-vertical-align,
    @_icon-font-position,
    @_icon-font-text-hide
) {
    .button-icon(
        @_icon-font-content: @_dropdown-toggle-icon-content,
        @_icon-font: @_icon-font,
        @_icon-font-size: @_icon-font-size,
        @_icon-font-line-height: @_icon-font-line-height,
        @_icon-font-color: @_icon-font-color,
        @_icon-font-color-hover: @_icon-font-color-hover,
        @_icon-font-color-active: @_icon-font-color-active,
        @_icon-font-margin: @_icon-font-margin,
        @_icon-font-vertical-align: @_icon-font-vertical-align,
        @_icon-font-position: @_icon-font-position,
        @_icon-font-text-hide: @_icon-font-text-hide
    );
    &.active {
        .button-icon(
            @_icon-font-content: @_dropdown-toggle-active-icon-content,
            @_icon-font: @_icon-font,
            @_icon-font-size: @_icon-font-size,
            @_icon-font-line-height: @_icon-font-line-height,
            @_icon-font-color: @_icon-font-color,
            @_icon-font-color-hover: @_icon-font-color-hover,
            @_icon-font-color-active: @_icon-font-color-active,
            @_icon-font-margin: @_icon-font-margin,
            @_icon-font-vertical-align: @_icon-font-vertical-align,
            @_icon-font-position: @_icon-font-position,
            @_icon-font-text-hide: @_icon-font-text-hide
        );
    }
}

// Split dropdown toggle position = left
._dropdown-split-toggle-position(
    @_button-selector,
    @_toggle-selector,
    @_dropdown-split-toggle-position,
    @_dropdown-split-button-border-radius-fix
) when (@_dropdown-split-toggle-position = left) {
    @{_button-selector} {
        float: right;
        margin: 0;
    }
    @{_toggle-selector} {
        float: left;
        margin: 0;
    }
}

// Split dropdown toggle position = right
._dropdown-split-toggle-position(
    @_button-selector,
    @_toggle-selector,
    @_dropdown-split-toggle-position,
    @_dropdown-split-button-border-radius-fix
) when (@_dropdown-split-toggle-position = right) {
    @{_button-selector} {
        float: left;
        margin: 0;
    }
    @{_toggle-selector} {
        float: right;
        margin: 0;
    }
}

// Split dropdown toggle position = right
// and
// Dropdown-split-button-border-radius-fix = true
._dropdown-split-toggle-position(
    @_button-selector,
    @_toggle-selector,
    @_dropdown-split-toggle-position,
    @_dropdown-split-button-border-radius-fix
) when (@_dropdown-split-toggle-position = right) and (@_dropdown-split-button-border-radius-fix = true) {
    button@{_button-selector} {
        -webkit-border-top-right-radius: 0;
        -webkit-border-bottom-right-radius: 0;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    button + @{_toggle-selector} {
        border-left: 0;
        -webkit-border-top-left-radius: 0;
        -webkit-border-bottom-left-radius: 0;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }
}

// Split dropdown toggle position = left
// and
// Dropdown-split-button-border-radius-fix = true
._dropdown-split-toggle-position(
    @_button-selector,
    @_toggle-selector,
    @_dropdown-split-toggle-position,
    @_dropdown-split-button-border-radius-fix
) when (@_dropdown-split-toggle-position = left) and (@_dropdown-split-button-border-radius-fix = true) {
    button@{_button-selector} {
        -webkit-border-top-left-radius: 0;
        -webkit-border-bottom-left-radius: 0;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }
    button + @{_toggle-selector} {
        border-right: 0;
        -webkit-border-top-right-radius: 0;
        -webkit-border-bottom-right-radius: 0;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
}

// Dropdown show pointer
._dropdown-list-pointer(
    @_dropdown-list-background,
    @_dropdown-list-pointer-border,
    @_dropdown-list-pointer-position,
    @_dropdown-list-pointer-position-top,
    @_dropdown-list-pointer-position-left-right
) when (@_dropdown-list-pointer = true) {
    margin-top: 4px;
    ._dropdown-pointer(
        @_dropdown-list-background,
        @_dropdown-list-pointer-border,
        @_dropdown-list-pointer-position,
        @_dropdown-list-pointer-position-top,
        @_dropdown-list-pointer-position-left-right
    );
}

._dropdown-pointer(
    @_dropdown-list-background,
    @_dropdown-list-pointer-border,
    @_dropdown-list-pointer-position,
    @_dropdown-list-pointer-position-top,
    @_dropdown-list-pointer-position-left-right
) when (@_dropdown-list-pointer-position = left) {
    ._dropdown-pointer-default(
        @_dropdown-list-background,
        @_dropdown-list-pointer-border
    );
    &:before {
        .css(top, @_dropdown-list-pointer-position-top);
        .css(left, @_dropdown-list-pointer-position-left-right);
    }
    &:after {
        .css(top, @_dropdown-list-pointer-position-top - 2);
        .css(left, @_dropdown-list-pointer-position-left-right - 1);
    }
}

._dropdown-pointer(
    @_dropdown-list-background,
    @_dropdown-list-pointer-border,
    @_dropdown-list-pointer-position,
    @_dropdown-list-pointer-position-top,
    @_dropdown-list-pointer-position-left-right
) when (@_dropdown-list-pointer-position = right) {
    ._dropdown-pointer-default(
        @_dropdown-list-background,
        @_dropdown-list-pointer-border
    );
    &:before {
        .css(top, @_dropdown-list-pointer-position-top);
        .css(right, @_dropdown-list-pointer-position-left-right);
    }
    &:after {
        .css(top, @_dropdown-list-pointer-position-top - 2);
        .css(right, @_dropdown-list-pointer-position-left-right - 1);
    }
}

._dropdown-pointer-default(
    @_dropdown-list-background,
    @_dropdown-list-pointer-border
) {
    &:before,
    &:after {
        content: "";
        position: absolute;
        display: block;
        width: 0;
        height: 0;
        border-bottom-style: solid;
    }
    &:before {
        z-index: 99;
        border: solid 6px;
        border-color: transparent transparent @_dropdown-list-background transparent;
    }
    &:after {
        z-index: 98;
        border: solid 7px;
        border-color: transparent transparent @_dropdown-list-pointer-border transparent;
    }
}

// Dropdown list item border != 0
._dropdown-list-item-border(
    @_dropdown-list-item-border
) when not (@_dropdown-list-item-border = 0) and not (@_dropdown-list-item-border = false) and not (@_dropdown-list-item-border = '') {
    .css(border-top, @_dropdown-list-item-border);
    &:first-child {
        border: none;
    }
}

// Dropdown list shadow
._dropdown-list-shadow(
    @_dropdown-list-shadow
) when not (@_dropdown-list-shadow = '') and not (@_dropdown-list-shadow = none) {
    .box-shadow(@_dropdown-list-shadow);
}
